Chart for WPF and Silverlight > Chart Features > Axis > Axis Title |
Adding a title to an axis clarifies what is charted along that axis. For example if your data includes measurements it’s helpful to include the unit of measurement (grams, meters, liters, etc) in the axis title. Axis titles can be added to Area, XY-Plot, Bar, HiLoOpenClose or Candle charts.
The axis titles are UIElement objects rather than simple text. This means you have complete flexibility over the format of the titles. In fact, you could use complex elements with buttons, tables, or images for the axis titles.
To set the Axis Title programmatically
C# |
Copy Code
|
---|---|
// Set axes titles c1Chart1.View.AxisY.Title= new TextBlock() { Text = "Kitchen Electronics" }; c1Chart1.View.AxisX.Title = new TextBlock() { Text = "Price" }; |
To set the Axis Title using XAML code
XAML |
Copy Code
|
---|---|
<c1chart:C1Chart > <c1chart:C1Chart.View> <c1chart:ChartView> <c1chart:ChartView.AxisX> <c1chart:Axis> <c1chart:Axis.Title> <TextBlock Text="Price" TextAlignment="Center" Foreground="Crimson"/> </c1chart:Axis.Title> </c1chart:Axis> </c1chart:ChartView.AxisX> <c1chart:ChartView.AxisY> <c1chart:Axis> <c1chart:Axis.Title> <TextBlock Text="Kitchen Electronics" TextAlignment="Center" Foreground="Crimson"/> </c1chart:Axis.Title> </c1chart:Axis> </c1chart:ChartView.AxisY> </c1chart:ChartView> </c1chart:C1Chart.View> </c1chart:C1Chart> |